#include "progressbar.h"
char load[4] = {'|','/','-','\\'};
void progress()
{
    char str[101];
    memset(str,0,sizeof(str));
    int i = 0;
    for(i = 0;i<101;++i)
    {
        printf("[%-100s][%d%%][%c]\r",str,i,load[i%4]);
        fflush(stdout);
        usleep(50000);
        str[i] = '#';
    }
    printf("\n");
}

char p_str[101];
void progress2(double rate)
{
    int cnt = (int)rate;
    printf("[%-100s][%.1lf%%][%c]\r",p_str,rate,load[cnt%4]);
    fflush(stdout);
    p_str[(int)rate] = '#';
}
